package com.bang.springcloud.report.controller;


import com.bang.framework.base.response.BaseController;
import com.bang.framework.base.response.Result;
import com.bang.springcloud.report.entity.SysMenu;
import com.bang.springcloud.report.service.ISysMenuService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 目录表 前端控制器
 * </p>
 *
 * @author bang
 * @since 2019-12-04
 */
@RestController
@RequestMapping("/menu")
public class SysMenuController extends BaseController {

    @Autowired
    private ISysMenuService sysMenuService;

    @Autowired
    private RabbitTemplate rabbitTemplate;

  @GetMapping("/get/{name}")
    public Result get(@PathVariable("name")  String name) {
        SysMenu sysMenu = sysMenuService.getById(name);
        return resultSuccess(sysMenu);
    }


    @GetMapping("/list")
    public Result list(@RequestParam(value = "page",defaultValue = "1") Integer page,@RequestParam(value = "size",defaultValue = "10") Integer size) {
        IPage<SysMenu> pageInfo = new Page<>(page,size);
        IPage<SysMenu> res = sysMenuService.page(pageInfo);
        return resultSuccess(res);
    }
}
